package org.example.FactoryPattern;
/**
 * 工厂类：住宿工厂
 * 根据类型创建不同的住宿对象，支持扩展
 */
public class AccommodationFactory {
    public Accommodation createAccommodation(int type) {
        switch (type) {
            case 1:
                return new StandardAccommodation();
            case 2:
                return new DeluxeAccommodation();
            default:
                throw new InvalidAccommodationTypeException(
                        "Invalid type: " + type + ". Valid types are 1 (Standard),2 (Deluxe)."
                );
        }
    }
}